import request from '/@/utils/request';
const headers = {
	onlyData: true,
};

//终止变更审核
export const appImplementation = (data: any) => {
	return request({
		url: `manage/appImplementation/approve`,
		method: 'post',
		data,
		// headers,
	});
};

//应用变更列表
export const changePage = (params: any) => {
	if (params.timeArr) {
		params['startTime'] = params.timeArr[0];
		params['endTime'] = params.timeArr[1];
	}
	delete params.timeArr;
	return request({
		url: `manage/impl/change/page`,
		method: 'get',
		params,
		// headers,
	});
};
//应用变更撤销
export const changeCancel = (data: any) => {
	return request({
		url: `manage/task/stopProcessInstance`,
		method: 'post',
		data,
	});
};
//应用变更删除
export const changeDelete = (params: any) => {
	return request({
		url: `manage/impl/change/delete/` + params,
		method: 'delete',
		// headers,
	});
};

//应用变更提交
export const changeSubmit = (data: any) => {
	return request({
		url: `manage/impl/change/submit`,
		method: 'post',
		data,
		// headers,
	});
};
//应用变更保存
export const changeSave = (data: any) => {
	return request({
		url: `manage/impl/change/save`,
		method: 'post',
		data,
		// headers,
	});
};

//应用变更审核
export const changeApprove = (data: any) => {
	return request({
		url: `manage/impl/change/approve`,
		method: 'post',
		data,
		// headers,
	});
};
//应用变更审核列表
export const changeVerify = (data: any) => {
	if (data.timeArr) {
		data['startTime'] = data.timeArr[0];
		data['endTime'] = data.timeArr[1];
	}
	delete data.timeArr;
	return request({
		url: `manage/impl/change/verify/page`,
		method: 'post',
		data,
		// headers,
	});
};
//应用变更详情
export const changeDetail = (params: any) => {
	return request({
		url: `manage/impl/change/detail/` + params,
		method: 'get',
		// params,
		// headers,
	});
};

//====
//终止变更审核列表
export const terminateVerify = (data: any) => {
	if (data.timeArr) {
		data['startTime'] = data.timeArr[0];
		data['endTime'] = data.timeArr[1];
	}
	delete data.timeArr;
	return request({
		url: `manage/impl/terminate/verify/page`,
		method: 'post',
		data,
		// headers,
	});
};

//终止变更列表
export const terminatePage = (params: any) => {
	if (params.timeArr) {
		params['startTime'] = params.timeArr[0];
		params['endTime'] = params.timeArr[1];
	}
	delete params.timeArr;
	return request({
		url: `manage/impl/terminate/page`,
		method: 'get',
		params,
		// headers,
	});
};
//终止变更撤销
export const terminateCancel = (data: any) => {
	return request({
		url: `manage/impl/terminate/cancel/` + data,
		method: 'post',
		// headers,
	});
};
//终止变更删除
export const terminateDelete = (params: any) => {
	return request({
		url: `manage/impl/terminate/delete/` + params,
		method: 'delete',
		// headers,
	});
};

//终止变更提交
export const terminateSubmit = (data: any) => {
	return request({
		url: `manage/impl/terminate/submit`,
		method: 'post',
		data,
		// headers,
	});
};
//终止变更保存
export const terminateSave = (data: any) => {
	return request({
		url: `manage/impl/terminate/save`,
		method: 'post',
		data,
		// headers,
	});
};

//终止变更审核
export const terminateApprove = (data: any) => {
	return request({
		url: `manage/impl/terminate/approve`,
		method: 'post',
		data,
		// headers,
	});
};

//终止变更详情
export const terminateDetail = (params: any) => {
	return request({
		url: `manage/impl/terminate/detail/` + params,
		method: 'get',
		// params,
		// headers,
	});
};

//=========应用变更审核

//应用变更审核列表
export const changePendingTask = (params: any) => {
	return request({
		url: `manage/impl/change/pending/task`,
		method: 'get',
		params,
		// headers,
	});
};

//判断能否撤回
export const recordBack = (data: any) => {
	return request({
		url: `manage/task/canBack`,
		method: 'post',
		// headers,
		data,
	});
};

//撤回
export const backExecute = (params: any) => {
	return request({
		url: `manage/process/record/back/execute/` + `${params.processInstanceId}/` + `${params.taskId}/` + `${params.nodeId}`,
		method: 'post',
		// headers,
	});
};
